package com.cr.front.brand.controller;


import com.cr.common.response.JsonResult;
import com.cr.front.brand.pojo.vo.BrandVO;
import com.cr.front.brand.service.BrandService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@Slf4j
@RestController
@RequestMapping("cr/brand/")
@Api(tags = "品牌模块")
public class BrandController {
    @Autowired
    BrandService brandService;
    @ApiOperation("查询热门品牌")
    @GetMapping("selectHot")
    public JsonResult SelectBrandHot(){
        List<BrandVO> list = brandService.selectHot();
        return JsonResult.success(list);
    }

    @ApiOperation("查询全部品牌")
    @GetMapping("selectAll")
    public JsonResult SelectBrandAll(){
        List<BrandVO> list = brandService.selectAll();
        return JsonResult.success(list);
    }

    @GetMapping("/selectLetterBrandList")
    @ApiOperation(value = "根据字母查品牌")
    public JsonResult selectLetterBrandList(){
        Map<Character,List<BrandVO>> map =  brandService.selectLetterBrandList();
        return JsonResult.success(map);
    }
}
